Skip to content

NO-JIRA: Fix flake in infracluster test - #578

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
openshift-cloud-team:infracluster-flake
Jun 4, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
openshift-cloud-team:infracluster-flake

Conversation

@mdbooth

@mdbooth mdbooth commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Fixes a timing error where we can try to delete the initially created
infracluster before it has been created.

Summary by CodeRabbit

  • Tests
    • Improved test stability by implementing timestamp-based validation instead of a fixed time delay, ensuring deterministic verification of machine creation ordering in test scenarios.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 4, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@mdbooth: This pull request explicitly references no jira issue.

Details

In response to this:

Fixes a timing error where we can try to delete the initially created
infracluster before it has been created.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Walkthrough

Updated test setup for the "Control Plane Machines but no ControlPlaneMachineSet" scenario to replace a fixed sleep delay with timestamp-based conditional waiting. The new logic ensures at least one second elapses since machine3 creation before creating machine2, making machine creation order deterministic and consistent with CreationTimestamp assertions.

Changes

Test Timing Reliability

Layer / File(s) Summary
Deterministic machine creation timestamp ordering
pkg/controllers/infracluster/infracluster_controller_test.go
Fixed sleep replaced with conditional time.Sleep that waits until at least one second has passed since machine3 was created, ensuring machine2 becomes the youngest machine deterministically.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Microshift Test Compatibility ⚠️ Warning New Ginkgo e2e tests use MicroShift-incompatible APIs (config.openshift.io ClusterOperator, machine.openshift.io Machine/ControlPlaneMachineSet) without any protection mechanisms. Add [apigroup:config.openshift.io] and [apigroup:machine.openshift.io] tags to test names, or wrap tests in a Describe with appropriate apigroup tags to auto-skip on MicroShift CI.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix flake in infracluster test' clearly and concisely summarizes the main change—addressing a timing-related test flakiness issue in the infracluster controller test file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All Ginkgo test names in the modified test are static strings with no dynamic information (no generated IDs, timestamps, pod/node names, or other variable values).
Test Structure And Quality ✅ Passed Test meets quality standards with separate It blocks for distinct behaviors, proper BeforeEach/AfterEach cleanup, 60s timeout on Eventually calls, and timestamp-based synchronization.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR does not add new Ginkgo tests, only modifies existing test setup in a unit test file. The SNO compatibility check applies only to new tests.
Topology-Aware Scheduling Compatibility ✅ Passed PR only modifies a test file; the custom check applies only to deployment manifests, operator code, or controller changes introducing scheduling constraints.
Ote Binary Stdout Contract ✅ Passed PR modifies test setup code within BeforeEach() block only; no stdout writes in process-level code detected, and klog properly redirected to GinkgoWriter in suite setup.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Ginkgo unit test in pkg/controllers/ using envtest. No IPv4 hardcoded addresses, external URLs, DNS lookups, or IPv4-only network logic detected. Test is not an e2e test as required by the check.
No-Weak-Crypto ✅ Passed PR contains only test timing logic changes with no cryptographic operations, weak algorithms, or insecure comparisons.
Container-Privileges ✅ Passed PR modifies only a Go test file with timing fixes. No container/K8s manifests with privilege settings were added or changed.
No-Sensitive-Data-In-Logs ✅ Passed The PR modifies only test timing logic (timestamp-based wait replacing sleep) with no logging statements added or sensitive data patterns detected in the modified file.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/controllers/infracluster/infracluster_controller_test.go (1)

174-175: Good fix for the race condition.

The wait ensures the InfraCluster exists before attempting deletion at line 190, directly addressing the flake described in the PR.

Consider adding an explicit timeout for improved robustness and faster failure diagnosis:

// Wait for the InfraCluster to be created.
Eventually(komega.Get(bareInfraCluster), "10s", "1s").Should(Succeed(), "InfraCluster should be created after machines exist")

Based on learnings: "Review Ginkgo test code for... timeouts - include appropriate timeouts on Eventually/Consistently calls".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/controllers/infracluster/infracluster_controller_test.go` around lines
174 - 175, Update the Eventually call that waits for the InfraCluster to include
explicit timeout and poll interval parameters and a failure message: modify the
Eventually(komega.Get(bareInfraCluster)).Should(Succeed()) usage to pass a
sensible timeout and interval (e.g., "10s", "1s") and include a descriptive
assertion message so the wait is bounded and failures are clearly reported when
waiting for bareInfraCluster creation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/controllers/infracluster/infracluster_controller_test.go`:
- Around line 174-175: Update the Eventually call that waits for the
InfraCluster to include explicit timeout and poll interval parameters and a
failure message: modify the
Eventually(komega.Get(bareInfraCluster)).Should(Succeed()) usage to pass a
sensible timeout and interval (e.g., "10s", "1s") and include a descriptive
assertion message so the wait is bounded and failures are clearly reported when
waiting for bareInfraCluster creation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: c36551a9-4ff5-41c5-b1a1-c90517bb8dd3

📥 Commits

Reviewing files that changed from the base of the PR and between 3f1aa11 and e162284.

📒 Files selected for processing (1)
  • pkg/controllers/infracluster/infracluster_controller_test.go

@mdbooth

mdbooth commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

/verified by CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jun 4, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@mdbooth: This PR has been marked as verified by CI.

Details

In response to this:

/verified by CI

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@damdo damdo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 4, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-capi-disconnected-techpreview
/test e2e-aws-capi-techpreview
/test e2e-aws-capi-techpreview-post-install
/test e2e-aws-ovn
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-aws-ovn-techpreview
/test e2e-aws-ovn-techpreview-upgrade
/test e2e-azure-capi-techpreview
/test e2e-azure-ovn-techpreview
/test e2e-azure-ovn-techpreview-upgrade
/test e2e-gcp-capi-techpreview
/test e2e-gcp-ovn-techpreview
/test e2e-metal3-capi-techpreview
/test e2e-openstack-capi-techpreview
/test e2e-openstack-ovn-techpreview
/test e2e-vsphere-capi-techpreview
/test regression-clusterinfra-aws-ipi-techpreview-capi

@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damdo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 4, 2026
@mdbooth

mdbooth commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

This change only affects integration test code — no production code changes. Overriding all e2e tests.

/override ci/prow/e2e-aws-capi-disconnected-techpreview ci/prow/e2e-aws-capi-techpreview ci/prow/e2e-aws-capi-techpreview-post-install ci/prow/e2e-aws-ovn ci/prow/e2e-aws-ovn-serial-1of2 ci/prow/e2e-aws-ovn-serial-2of2 ci/prow/e2e-aws-ovn-techpreview ci/prow/e2e-aws-ovn-techpreview-upgrade ci/prow/e2e-azure-capi-techpreview ci/prow/e2e-azure-ovn-techpreview ci/prow/e2e-azure-ovn-techpreview-upgrade ci/prow/e2e-gcp-capi-techpreview ci/prow/e2e-gcp-ovn-techpreview ci/prow/e2e-metal3-capi-techpreview ci/prow/e2e-openstack-capi-techpreview ci/prow/e2e-openstack-ovn-techpreview ci/prow/e2e-vsphere-capi-techpreview ci/prow/regression-clusterinfra-aws-ipi-techpreview-capi

@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@mdbooth: Overrode contexts on behalf of mdbooth: ci/prow/e2e-aws-capi-disconnected-techpreview, ci/prow/e2e-aws-capi-techpreview, ci/prow/e2e-aws-capi-techpreview-post-install, ci/prow/e2e-aws-ovn, ci/prow/e2e-aws-ovn-serial-1of2, ci/prow/e2e-aws-ovn-serial-2of2, ci/prow/e2e-aws-ovn-techpreview, ci/prow/e2e-aws-ovn-techpreview-upgrade, ci/prow/e2e-azure-capi-techpreview, ci/prow/e2e-azure-ovn-techpreview, ci/prow/e2e-azure-ovn-techpreview-upgrade, ci/prow/e2e-gcp-capi-techpreview, ci/prow/e2e-gcp-ovn-techpreview, ci/prow/e2e-metal3-capi-techpreview, ci/prow/e2e-openstack-capi-techpreview, ci/prow/e2e-openstack-ovn-techpreview, ci/prow/e2e-vsphere-capi-techpreview, ci/prow/regression-clusterinfra-aws-ipi-techpreview-capi

Details

In response to this:

This change only affects integration test code — no production code changes. Overriding all e2e tests.

/override ci/prow/e2e-aws-capi-disconnected-techpreview ci/prow/e2e-aws-capi-techpreview ci/prow/e2e-aws-capi-techpreview-post-install ci/prow/e2e-aws-ovn ci/prow/e2e-aws-ovn-serial-1of2 ci/prow/e2e-aws-ovn-serial-2of2 ci/prow/e2e-aws-ovn-techpreview ci/prow/e2e-aws-ovn-techpreview-upgrade ci/prow/e2e-azure-capi-techpreview ci/prow/e2e-azure-ovn-techpreview ci/prow/e2e-azure-ovn-techpreview-upgrade ci/prow/e2e-gcp-capi-techpreview ci/prow/e2e-gcp-ovn-techpreview ci/prow/e2e-metal3-capi-techpreview ci/prow/e2e-openstack-capi-techpreview ci/prow/e2e-openstack-ovn-techpreview ci/prow/e2e-vsphere-capi-techpreview ci/prow/regression-clusterinfra-aws-ipi-techpreview-capi

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 473cc9a into openshift:main Jun 4, 2026
27 checks passed
@openshift-ci

openshift-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@mdbooth: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@mdbooth
mdbooth deleted the infracluster-flake branch June 4, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants